-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cart and session restore with payment gateways #2231
base: canary
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
useEffect(() => { | ||
if (!reviveNow) return // eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
;(async () => { | ||
// In GraphCommerce 8 the user would automatically be presented with a restore session dialog | ||
if (customer_token) { | ||
client.cache.writeQuery({ | ||
query: CustomerTokenDocument, | ||
broadcast: true, | ||
data: { | ||
customerToken: { | ||
__typename: 'CustomerToken', | ||
token: customer_token, | ||
createdAt: new Date().toUTCString(), | ||
valid: true, | ||
}, | ||
}, | ||
}) | ||
} else { | ||
client.cache.evict({ fieldName: 'customerToken' }) | ||
} | ||
|
||
const restoredId = (await restore({ variables: { cartId: cart_id } })).data?.getPaymentMeta | ||
|
||
if (restoredId) assignCurrentCartId(restoredId) | ||
|
||
await unlock({ customer_token: null, order_number: null, success: null }) | ||
})() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need this for daxtrio
No description provided.